Skip to content

add tcp-p3 example and test#204

Open
rvolosatovs wants to merge 1 commit intobytecodealliance:mainfrom
rvolosatovs:p3-tcp-example
Open

add tcp-p3 example and test#204
rvolosatovs wants to merge 1 commit intobytecodealliance:mainfrom
rvolosatovs:p3-tcp-example

Conversation

@rvolosatovs
Copy link
Member

@rvolosatovs rvolosatovs commented Feb 18, 2026

Adapt the tcp example to p3 using wasi-sockets API directly until wasi-libc/wasi-sdk/cpython are further along in p3 support

Comment on lines +43 to +45
response before exiting. You can give it a response by typing anything you like
into the terminal where `netcat` is running and then pressing the `Enter` key on
your keyboard.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not actually happen, but I'm assuming that's a temporary bug

recv_rx, recv_fut = sock.receive()
async def read():
with recv_rx:
data = await recv_rx.read(1024)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By some reason, this does not block on empty buffers - I assumed that this would only ever return a non-zero buffer or an error.

For example, if nc is invoked like so:

echo test | nc -l 127.0.0.1 3456

The component receives test.

There is no way to send data to the component via nc after the component has connected.

I am assuming this is a bug in componentize-py?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the spec (https://github.com/WebAssembly/component-model/blob/c7176a512c0bbe4654849f4ba221c1a71c7cf514/design/mvp/Concurrency.md#stream-readiness):

When passed a non-zero-length buffer, the stream.read and stream.write built-ins are "completion-based" (in the style of, e.g., Overlapped I/O or io_uring) in that they complete only once one or more values have been copied to or from the memory buffer passed in at the start of the operation.

@rvolosatovs rvolosatovs force-pushed the p3-tcp-example branch 3 times, most recently from 1670783 to c3e69c5 Compare February 18, 2026 14:17
@rvolosatovs
Copy link
Member Author

Interesting, the CI just broke a few minutes ago (https://github.com/bytecodealliance/componentize-py/actions/runs/22143392814/job/64013519262?pr=204)

/usr/bin/git submodule sync --recursive
/usr/bin/git -c protocol.version=2 submodule update --init --force --depth=1 --recursive
Submodule 'cpython' (https://github.com/dicej/cpython) registered for path 'cpython'
Cloning into '/home/runner/work/componentize-py/componentize-py/cpython'...
Error: fatal: could not read Username for 'https://github.com/': terminal prompts disabled
Error: fatal: expected flush after ref listing
Unable to fetch in submodule path 'cpython'; trying to directly fetch 0e13686da8bb881b059d35e23c32bcd2e6440099:
Error: fatal: could not read Username for 'https://github.com/': terminal prompts disabled
Error: fatal: Fetched in submodule path 'cpython', but it did not contain 0e13686da8bb881b059d35e23c32bcd2e6440099. Direct fetching of that commit failed.
Error: The process '/usr/bin/git' failed with exit code 128/usr/bin/git submodule sync --recursive
/usr/bin/git -c protocol.version=2 submodule update --init --force --depth=1 --recursive
Submodule 'cpython' (https://github.com/dicej/cpython) registered for path 'cpython'
Cloning into '/home/runner/work/componentize-py/componentize-py/cpython'...
Error: fatal: could not read Username for 'https://github.com/': terminal prompts disabled
Error: fatal: expected flush after ref listing
Unable to fetch in submodule path 'cpython'; trying to directly fetch 0e13686da8bb881b059d35e23c32bcd2e6440099:
Error: fatal: could not read Username for 'https://github.com/': terminal prompts disabled
Error: fatal: Fetched in submodule path 'cpython', but it did not contain 0e13686da8bb881b059d35e23c32bcd2e6440099. Direct fetching of that commit failed.
Error: The process '/usr/bin/git' failed with exit code 128

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments